home *** CD-ROM | disk | FTP | other *** search
/ PC Advisor 1998 May / PC Advisor Issue 32 (May 1998).ISO / csi26uk / scripts.lib / CONNECT.SCR < prev    next >
Text File  |  1996-09-23  |  10KB  |  434 lines

  1. !
  2. !  Copyright (c) 1996
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CONNECT:
  9. !    Handles CompuServe and Direct.
  10. !
  11. !  NOTE:  It is recommended that the numeric codes for networks NOT be
  12. !    modified since other utility programs may assume the relationships
  13. !    of network names and network ids specified below.
  14. !
  15. !+V
  16. ! "3.9.1"
  17. !-V
  18.  
  19. !+N
  20. CompuServe = 1;        ! "CompuServe"
  21. AlaskaNet = 36;        ! "AlaskaNet"
  22. ArgNet = 37;        ! "ARG-Net"
  23. Chilepac= 28;        ! "Chilepac"
  24. CSIRnet = 16;        ! "CSIR-Net"
  25. DataPac = 4;        ! "DataPac"
  26. Datex_J = 19;        ! "Datex-J"
  27. Datex_P = 10;        ! "Datex-P"
  28. EIRPAC = 33;        ! "EIRPAC"
  29. FENICSII = 24;        ! "FENICS II/IV"
  30. FTConnect = 12;        ! "FT-Connect"
  31. Dialplus = 11;        ! "GNS Dialplus"
  32. PosServe = 27;        ! "HANJIN-NET"
  33. InfoNet_Europe = 5;    ! "InfoNet-Euro"
  34. InfoNet_Korea = 29;    ! "InfoNet-Kor"
  35. InfoNet_Mexico = 31;    ! "InfoNet-Mex"
  36. InfoNet_SAfrica = 32;    ! "InfoNet-RSA"
  37. InfoNet_Taiwan = 30;    ! "InfoNet-Taiw"
  38. InfoNet_World = 6;    ! "InfoNet-Wrld"
  39. Internet = 25;        ! "Internet"
  40. ISRAKAV = 17;        ! "ISRAKAV"
  41. LATA = 7;        ! "LATA"
  42. CTLATA = 8;        ! "LATA-Ct"
  43. Mercury = 15;        ! "Mercury"
  44. PacNet = 21;        ! "PacNet"
  45. SCITOR = 34;        ! "SCITOR"
  46. SEVA = 35;        ! "SEVA"
  47. Telenet = 2;        ! "SprintNet"
  48. Telepac = 9;        ! "Telepac"
  49. Transpac = 18;        ! "Transpac"
  50. TTNNet = 22;        ! "TTN-Net"
  51. Tymnet = 3;        ! "Tymnet"
  52. VNZNET = 23;        ! "VNZ-Net"
  53. Direct = 40;        ! "Direct"
  54. !-N
  55.  
  56. define %CR = "^M";
  57. define %FALSE = 0;
  58. define %TRUE = 1;
  59. define %ErrorCode = 0;
  60. define %PPP = "";
  61. define %GatewayFailure = 0;
  62. GatewayRetry = 0;
  63. define %State = 1;
  64. ! %State defines the state of the connection:
  65. !    1 - Opening port
  66. !    2 - Initializing modem
  67. !    3 - Dialing phone
  68. !    4 - Connecting through alternate gateway
  69. !    5 - Connecting to CompuServe network (Host Name:)
  70. !    6 - Responding to User ID
  71. !    7 - Responding to Password/Secure login
  72. !    8 - Exited success
  73. !    9 - Reserved
  74. !    10 - Disconnecting Network
  75. !    11 - Hanging up modem
  76. !    12 - Exited success
  77. hangup = 1;
  78. UsingModem = %FALSE;
  79. CISNetwork = %FALSE;
  80. ifndef %App = "";
  81. if (%App = "CID") and (%Network = Internet) goto Dialer;
  82.  
  83. Initialize:
  84. !
  85. ! Main Program
  86. !
  87. init %Port, %BaudRate;
  88. if %_init goto Continue_Connect;
  89.  
  90. define %FailureMsg = "Could not initialize port";
  91. define %ErrorCode = 2;
  92. if %Network <> Internet goto Connect_Fatal;
  93. define %ErrorCode = 3;
  94. goto Connect_Fatal;
  95.  
  96. Dialer:
  97. define %Network = CompuServe;
  98. goto Initialize;
  99.  
  100. Continue_Connect:
  101.     call %Dir & "first.scr" () : Result;
  102.     if Result = %Cancel goto Cancel_Connect;
  103.     if Result = %Failure goto Connect_Failure;
  104.     if Result = %Fatal goto Connect_Fatal;
  105.  
  106.     on cancel goto Cancel_Connect;
  107.     DirectConnect = (%Network = Direct) or (%DialType = 2);
  108.  
  109.     if DirectConnect goto Connect_Network;
  110.  
  111.     call %Dir & "phone.scr" () : Result;
  112.  
  113.     if Result = %Cancel goto Cancel_Connect;
  114.     if Result = %Failure goto Connect_Failure;
  115.     if Result = %Fatal goto Connect_Fatal;
  116.     UsingModem = %TRUE;
  117.  
  118. Connect_Network:
  119.     if %Network = CompuServe goto Connect_CIS;
  120.     if %Network = Direct goto Connect_CIS;
  121.     if %Network = Internet goto Connect_CIS;
  122.     if %Network = VNZNET goto Connect_CIS;
  123.     define %State = 4;
  124.     if %Network = Telenet goto Connect_Telenet;
  125.     if %Network = Tymnet goto Connect_Tymnet;
  126.     if %Network = DataPac goto Connect_DataPac;
  127.     if %Network = InfoNet_Europe goto Connect_InfoNet_Europe;
  128.     if %Network = InfoNet_Korea goto Connect_InfoNet_Korea;
  129.     if %Network = InfoNet_Taiwan goto Connect_InfoNet_Taiwan;
  130.     if %Network = InfoNet_Mexico goto Connect_InfoNet_Mexico;
  131.     if %Network = InfoNet_SAfrica goto Connect_InfoNet_SAfrica;
  132.     if %Network = InfoNet_World goto Connect_InfoNet_World;
  133.     if %Network = LATA goto Connect_LATA;
  134.     if %Network = CTLATA goto Connect_CTLATA;
  135.     if %Network = Telepac goto Connect_Telepac;
  136.     if %Network = Datex_P goto Connect_Datex_P;
  137.     if %Network = Datex_J goto Connect_Datex_J;
  138.     if %Network = Dialplus goto Connect_Dialplus;
  139.     if %Network = Mercury goto Connect_Mercury;
  140.     if %Network = CSIRnet goto Connect_CSIRnet;
  141.     if %Network = ISRAKAV goto Connect_ISRAKAV;
  142.     if %Network = Transpac goto Connect_Transpac;
  143.     if %Network = PacNet goto Connect_PacNet;
  144.     if %Network = PosServe goto Connect_PosServe;
  145.     if %Network = TTNNet goto Connect_TTNNet;
  146.     if %Network = FENICSII goto Connect_FENICSII;
  147.     if %Network = Chilepac goto Connect_Chilepac;
  148.         if %Network = EIRPAC goto Connect_EIRPAC;
  149.         if %Network = SCITOR goto Connect_SCITOR;
  150.         if %Network = SEVA goto Connect_SEVA;
  151.         if %Network = AlaskaNet goto Connect_AlaskaNet;
  152.         if %Network = ArgNet goto Connect_ArgNet;
  153.         if %Network = FTConnect goto Connect_FTConnect;
  154.  
  155.     define %FailureMsg = "Network not supported";
  156.     goto Connect_Fatal;
  157.  
  158. !
  159. !  Connect to Telenet
  160. !
  161. Connect_Telenet:
  162.     call %Dir & "telenet.scr" () : Result;
  163.     goto Handle_Network_Return;
  164.  
  165. !
  166. !  Connect to Tymnet
  167. !
  168. Connect_Tymnet:
  169.     call %Dir & "tymnet.scr" (1) : Result;
  170.     goto Handle_Network_Return;
  171.  
  172. !
  173. !  Connect to DataPac
  174. !
  175. Connect_DataPac:
  176.     call %Dir & "datapac.scr" () : Result;
  177.     goto Handle_Network_Return;
  178.  
  179. !
  180. !  Connect to InfoNet World
  181. !
  182. Connect_InfoNet_World:
  183.     call %Dir & "infonet.scr" (0) : Result;
  184.     goto Handle_Network_Return;
  185.  
  186. !
  187. !  Connect to InfoNet Europe
  188. !
  189. Connect_InfoNet_Europe:
  190.     call %Dir & "infonet.scr" (1) : Result;
  191.     goto Handle_Network_Return;
  192.  
  193. !
  194. !  Connect to InfoNet Korea
  195. !
  196. Connect_InfoNet_Korea:
  197.     call %Dir & "infonet.scr" (2) : Result;
  198.     goto Handle_Network_Return;
  199.  
  200. !
  201. !  Connect to InfoNet Taiwan
  202. !
  203. Connect_InfoNet_Taiwan:
  204.     call %Dir & "infonet.scr" (3) : Result;
  205.     goto Handle_Network_Return;
  206.  
  207. !
  208. !  Connect to InfoNet Mexico
  209. !
  210. Connect_InfoNet_Mexico:
  211.     call %Dir & "infonet.scr" (4) : Result;
  212.     goto Handle_Network_Return;
  213.  
  214. !
  215. !  Connect to InfoNet South Africa
  216. !
  217. Connect_InfoNet_SAfrica:
  218.     call %Dir & "infonet.scr" (5) : Result;
  219.     goto Handle_Network_Return;
  220.  
  221. !
  222. !  Connect to LATA
  223. !
  224. Connect_LATA:
  225.     call %Dir & "lata.scr" (%TRUE) : Result;
  226.     goto Handle_Network_Return;
  227.  
  228. !
  229. !  Connect to Connecticut LATA
  230. !
  231. Connect_CTLATA:
  232.     call %Dir & "lata.scr" (%FALSE) : Result;
  233.     goto Handle_Network_Return;
  234.  
  235. !
  236. !  Connect to Telepac
  237. !
  238. Connect_Telepac:
  239.     call %Dir & "telepac.scr" () : Result;
  240.     goto Handle_Network_Return;
  241.  
  242. !
  243. !  Connect to Datex-P
  244. !
  245. Connect_Datex_P:
  246.     call %Dir & "datexp.scr" () : Result;
  247.     goto Handle_Network_Return;
  248.  
  249. !
  250. !  Connect to Datex-J
  251. !
  252. Connect_Datex_J:
  253.     call %Dir & "datexj.scr" () : Result;
  254.     goto Handle_Network_Return;
  255.  
  256. !
  257. !  Connect to Dialplus
  258. !
  259. Connect_Dialplus:
  260.     call %Dir & "dialplus.scr" () : Result;
  261.     goto Handle_Network_Return;
  262.  
  263. !
  264. !  Connect to FT-Connect
  265. !
  266. Connect_FTConnect:
  267.         call %Dir & "ftconn.scr" () : Result;
  268.     goto Handle_Network_Return;
  269.  
  270. !
  271. !  Connect to Mercury
  272. !
  273. Connect_Mercury:
  274.     call %Dir & "mercury.scr" () : Result;
  275.     goto Handle_Network_Return;
  276.  
  277. !
  278. !  Connect to CSIR-Net
  279. !
  280. Connect_CSIRnet:
  281.     call %Dir & "csirnet.scr" () : Result;
  282.     goto Handle_Network_Return;
  283.  
  284. !
  285. !  Connect to ISRAKAV
  286. !
  287. Connect_ISRAKAV:
  288.     call %Dir & "israkav.scr" () : Result;
  289.     goto Handle_Network_Return;
  290.  
  291. !
  292. !  Connect to Transpac
  293. !
  294. Connect_Transpac:
  295.     call %Dir & "transpac.scr" () : Result;
  296.     goto Handle_Network_Return;
  297.  
  298. !
  299. !  Connect to AlaskaNet
  300. !
  301. Connect_AlaskaNet:
  302.     call %Dir & "tymnet.scr" (2) : Result;
  303.     goto Handle_Network_Return;
  304.  
  305. !
  306. !  Connect to ArgNet
  307. !
  308. Connect_ArgNet:
  309.     call %Dir & "argnet.scr" () : Result;
  310.     goto Handle_Network_Return;
  311.  
  312. !
  313. !  Connect to PacNet
  314. !
  315. Connect_PacNet:
  316.     call %Dir & "tymnet.scr" (3) : Result;
  317.     goto Handle_Network_Return;
  318.  
  319.     
  320. !
  321. !  Connect to Pos-Serve
  322. !
  323. Connect_PosServe:
  324.     call %Dir & "posserve.scr" () : Result;
  325.     goto Handle_Network_Return;
  326.  
  327. !
  328. !  Connect to TTN-Net
  329. !
  330. Connect_TTNNet:
  331.     call %Dir & "ttnnet.scr" (3) : Result;
  332.     goto Handle_Network_Return;
  333.  
  334. !
  335. !  Connect to FENICS II
  336. !
  337. Connect_FENICSII:
  338.     call %Dir & "fenics2.scr" (3) : Result;
  339.     goto Handle_Network_Return;
  340.  
  341. !
  342. !  Connect to Chilepac
  343. !
  344. Connect_Chilepac:
  345.     call %Dir & "chilepac.scr" (3) : Result;
  346.     goto Handle_Network_Return;
  347.  
  348. !
  349. !  Connect to EIRPAC
  350. !
  351. Connect_EIRPAC:
  352.         call %Dir & "eirpac.scr" () : Result;
  353.     goto Handle_Network_Return;
  354.  
  355. !
  356. !  Connect to SCITOR
  357. !
  358. Connect_SCITOR:
  359.         call %Dir & "scitor.scr" () : Result;
  360.     goto Handle_Network_Return;
  361.  
  362. !
  363. !  Connect to SEVA
  364. !
  365. Connect_SEVA:
  366.         call %Dir & "seva.scr" () : Result;
  367.     goto Handle_Network_Return;
  368.  
  369.  
  370. !
  371. !  Handle Network Return
  372. !
  373. Handle_Network_Return:
  374.     if Result = %Success goto Do_CIS_Script;
  375.     if Result = %Cancel goto Cancel_Connect;
  376.     if Result = %Fatal goto Connect_Fatal;
  377.     goto Connect_Failure;
  378.  
  379. !
  380. !  Connect to CIS
  381. !
  382. Connect_CIS:
  383.     CISNetwork = %TRUE;
  384.     send %CR;
  385.  
  386. Do_CIS_Script:
  387.     call %Dir & "cserve.scr" (DirectConnect, CISNetwork) : Result;
  388.     if Result = %Failure goto Connect_Failure;
  389.     if Result = %Cancel goto Cancel_Connect;
  390.     if Result = %Fatal goto Connect_Fatal;
  391.     exit %Success;
  392.  
  393. Connect_Failure:
  394.     if %GatewayFailure = 0 goto ExitFailure;
  395.     define %GatewayFailure = 0;
  396.     if GatewayRetry = 3 goto ExitFailure;
  397.     GatewayRetry = GatewayRetry + 1;
  398.     wait until 50;
  399.     reset;
  400.     goto Initialize;
  401.  
  402. ExitFailure:
  403.     gosub Hangup_Connect;
  404.     reset;
  405.     exit %Failure;
  406.  
  407. Connect_Fatal:
  408.     if %GatewayFailure = 0 goto Gateway_OK;
  409.     define %GatewayFailure = 0;
  410.     if GatewayRetry = 3 goto ExitFailure;
  411.     GatewayRetry = GatewayRetry + 1;
  412.     wait until 50;
  413.     reset;
  414.     goto Initialize;
  415.     
  416. Gateway_OK:
  417.     gosub Hangup_Connect;
  418.     reset;
  419.     exit %Fatal;
  420.  
  421. Hangup_Connect:
  422.     if not UsingModem goto Hangup_Done;
  423.     define %LOCAL = 1;
  424.     call %Dir & "disconct.scr" ();
  425. Hangup_Done:
  426.     return;
  427.  
  428. Cancel_Connect:
  429.     show "Connect cancelled";
  430.     gosub Hangup_Connect;
  431.     reset;
  432.     define %ErrorCode = 1;
  433.     exit %Cancel;
  434.